(function(){
	var $googleaccount = $('#googleaccount .tag');
	var $google_uname = $($googleaccount[0]);
	var $google_passwd = $($googleaccount[1]);
	var $google_submit = $($googleaccount[2]);
	$google_submit.click(function(){
		$.post('/setting/type/google',{'uname':$google_uname.val(),'passwd':$google_passwd.val()},function(result){
			if(!!result){
				alert('设置google账号成功！');
			}else{
				alert('设置google账号失败！');
			}
		})
	});
	
	var $bloginfo = $('#bloginfo .tag');
	var $bloginfo_spacename = $($bloginfo[0]);
	var $bloginfo_description = $($bloginfo[1]);
	var $bloginfo_spaceUrl = $($bloginfo[2]);
	var $bloginfo_submit = $($bloginfo[3]);
	$bloginfo_submit.click(function(){
		$.post('/setting/type/bloginfo',{'spacename':$bloginfo_spacename.val(),'description':$bloginfo_description.val(),'spaceUrl':$bloginfo_spaceUrl.val()},function(result){
			if(!!result){
				alert('设置博客信息成功！');
			}else{
				alert('设置博客信息失败！');
			}
		})
	});
	
	var $userinfo = $('#userInfo .tag');
	var $userinfo_email = $($userinfo[0]);
	var $userinfo_password = $($userinfo[1]);
	var $userinfo_nickname = $($userinfo[2]);
	var $userinfo_isadmin = $($userinfo[3]);
	var $userinfo_submit = $($userinfo[4]);
	$userinfo_submit.click(function(){
		$.post('/setting/type/addUser',{'email':$userinfo_email.val(),'password':$userinfo_password.val(),'nickname':$userinfo_nickname.val(),'isadmin':$userinfo_isadmin.val()},function(result){
			if(!!result){
				alert('添加新用户成功！');
			}else{
				alert('添加新用户失败！');
			}
		})
	});
})();